/*
 * GastoForm.java
 *
 * Created on 12 de julio de 2008, 19:16
 */

package View;

import Model.Congreso;
import Model.Pedido;
import Controller.RPedidoController;

/**
 *
 * @author  Gigin
 */
public class FichaPedidos extends javax.swing.JDialog {

    private Congreso mCongreso;
    private RPedidoController mRPedidoController;
    private Pedido auxPedido;
    /** Creates new form GastoForm */
    public FichaPedidos(java.awt.Frame parent, boolean modal, Pedido pedido) {
        super(parent, modal);
        initComponents();
        String data;
        auxPedido = new Pedido();
        auxPedido = pedido;
        mRPedidoController = new RPedidoController();
        jNombreCliente.setText(pedido.getCliente().getApellidoCli()+ " " + pedido.getCliente().getNombreCli());
        jLabel1.setText(pedido.getDVDs().toString());
        jNomCongreso.setText(pedido.getCongreso().getNombreCong());
        
        // Cuando fue a la oficina ya no sabes de que congreso es... No se de  donde sacarlo...
        jTotal.setText(Float.toString(pedido.getTotal()));
        jSenia.setText(Float.toString(pedido.getSenia()));
       // jEnvio.setText(Integer.toString(pedido.getDescuento())+ "%");
         jEnvio.setText(Float.toString(pedido.getTotal()-pedido.getSenia()));
        numPedido.setText(Integer.toString(pedido.getNroPedido()));
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jNombreCliente = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jButtonImprimir = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        numPedido = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jNomCongreso = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jTotal = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jSenia = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jEnvio = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jButton1.setFont(new java.awt.Font("Verdana", 1, 10));
        jButton1.setForeground(new java.awt.Color(94, 148, 189));
        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_normal.gif"))); // NOI18N
        jButton1.setToolTipText("Agregar gasto");
        jButton1.setBorderPainted(false);
        jButton1.setContentAreaFilled(false);
        jButton1.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_deshabilitado.gif"))); // NOI18N
        jButton1.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_presionado.gif"))); // NOI18N
        jButton1.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Aceptar_mouse.gif"))); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jNombreCliente.setFont(new java.awt.Font("Monotype Corsiva", 1, 24));
        jNombreCliente.setForeground(new java.awt.Color(94, 148, 189));
        jNombreCliente.setText("Nuevo Gasto");

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/logo_GTV4.gif"))); // NOI18N

        jButtonImprimir.setFont(new java.awt.Font("Verdana", 1, 10));
        jButtonImprimir.setForeground(new java.awt.Color(94, 148, 189));
        jButtonImprimir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Imprimir_normal.gif"))); // NOI18N
        jButtonImprimir.setToolTipText("Imprimir la lista de dvs que deben copiarse");
        jButtonImprimir.setBorderPainted(false);
        jButtonImprimir.setContentAreaFilled(false);
        jButtonImprimir.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Imprimir_deshabilitado.gif"))); // NOI18N
        jButtonImprimir.setFocusPainted(false);
        jButtonImprimir.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Imprimir_presionado.gif"))); // NOI18N
        jButtonImprimir.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Imprimir_mouse.gif"))); // NOI18N
        jButtonImprimir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonImprimirActionPerformed(evt);
            }
        });

        jLabel1.setText("jLabel1");

        jLabel2.setText("N° de Pedido:");

        numPedido.setText("jLabel3");

        jLabel5.setText("Congreso:");

        jLabel6.setText("Dvds:");

        jNomCongreso.setText("jLabel3");

        jLabel3.setText("Total:");

        jTotal.setText("jLabel7");

        jLabel7.setText("Seña:");

        jSenia.setText("jLabel8");

        jLabel8.setText("Pendiente:");

        jEnvio.setText("jLabel9");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(355, Short.MAX_VALUE)
                .addComponent(jButtonImprimir, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(102, 102, 102))
            .addGroup(layout.createSequentialGroup()
                .addGap(76, 76, 76)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addGap(18, 18, 18)
                        .addComponent(jEnvio))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel5)
                            .addComponent(jLabel6)
                            .addComponent(jLabel3)
                            .addComponent(jLabel7))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jSenia)
                            .addComponent(jTotal)
                            .addComponent(jLabel1)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(numPedido)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 239, Short.MAX_VALUE)
                                .addComponent(jLabel4))
                            .addComponent(jNomCongreso))))
                .addContainerGap())
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(49, 49, 49)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(42, 42, 42)
                            .addComponent(jNombreCliente))
                        .addGroup(layout.createSequentialGroup()
                            .addGap(11, 11, 11)
                            .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(316, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 178, Short.MAX_VALUE)
                        .addComponent(jButtonImprimir, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(95, 95, 95)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(numPedido))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(jNomCongreso))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6)
                            .addComponent(jLabel1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(jTotal))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(jSenia))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(jEnvio))))
                .addContainerGap())
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jNombreCliente)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 235, Short.MAX_VALUE)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    this.dispose();
}//GEN-LAST:event_jButton1ActionPerformed

private void jButtonImprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonImprimirActionPerformed
   if (auxPedido.getCliente().getDireccion()==null)
       auxPedido.getCliente().setDireccion(" ");
    mRPedidoController.imprimirComprobante(String.valueOf(auxPedido.getNroPedido()), 
                    auxPedido.getCliente().getApellidoCli()+ ", "+ auxPedido.getCliente().getNombreCli(),
                    auxPedido.getCliente().getDireccion(), auxPedido.getDVDs(),
                    auxPedido.getFecha(), String.valueOf(auxPedido.getTotal()), 
                    String.valueOf(auxPedido.getSenia()),
                    String.valueOf(auxPedido.getTotal()-auxPedido.getSenia()), 
                    auxPedido.getCongreso().getIniciales());
}//GEN-LAST:event_jButtonImprimirActionPerformed


   public void setCongreso(Congreso val){
        this.mCongreso = val;
   }
   
   public Congreso getCongreso(){
        return this.mCongreso;
   }
    /**
    * @param args the command line arguments
    */
/*    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                GastoForm dialog = new GastoForm(new javax.swing.JFrame(), true, new ECajaForm);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

  */
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButtonImprimir;
    private javax.swing.JLabel jEnvio;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jNomCongreso;
    private javax.swing.JLabel jNombreCliente;
    private javax.swing.JLabel jSenia;
    private javax.swing.JLabel jTotal;
    private javax.swing.JLabel numPedido;
    // End of variables declaration//GEN-END:variables

}
